package me.zhengjie.modules.system.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.domain.ProjectApproval;
import me.zhengjie.modules.system.domain.UserInsuranceInfo;
import me.zhengjie.modules.system.service.ProjectApprovalService;
import me.zhengjie.modules.system.service.UserInsuranceInfoService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "项目审批")
@RestController
@RequestMapping("/api/projectApproval")
@RequiredArgsConstructor
public class ProjectApprovalController {
    private final ProjectApprovalService projectApprovalService;

    @ApiOperation("新增")
    @PostMapping(value = "/save")
    public ResponseEntity<Object> save(@RequestBody ProjectApproval projectApproval) {
        projectApprovalService.save(projectApproval);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @ApiOperation("列表")
    @GetMapping(value = "/list")
    public ResponseEntity<Object> list(String name) {
        List<ProjectApproval> list = projectApprovalService.list(name);
        return new ResponseEntity<>(list, HttpStatus.OK);
    }

    @ApiOperation("删除")
    @GetMapping(value = "/delete")
    public ResponseEntity<Object> delete(Long id) {
        projectApprovalService.delete(id);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
